import { CoolController, BaseController } from '@cool-midway/core';
import { UserAudioSettingEntity } from '../../entity/setting';
import { UserSettingService } from '../../service/setting';
import { Get, Inject } from '@midwayjs/core';

/**
 * 用户-音频设置
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: UserAudioSettingEntity,
  service: UserSettingService,
  insertParam: (ctx => {
    return {
      // 获得当前登录的后台用户ID，需要请求头传Authorization参数
      userId: ctx.user.id
    }
  }),
})
export class AppUserAudioSettingController extends BaseController {
  @Inject()
  userSettingService: UserSettingService;

  /**
  * 设置日志保存时间
  */
  @Get('/settingUserInfo', { summary: '获取当前登录用户的设置信息' })
  public async settingUserInfo() {
    return this.ok(await this.userSettingService.settingUserInfo());
  }
}
